#ifndef __OCONTENT_H__
#define __OCONTENT_H__

/** @brief Manager of game resource. Game resource can be loaded from a certain directory or a .game file.
 .game file is a zip pack with game stuff. Encryption for .game file is provided later.
*/
class oDLL oContent
{
public:
	~oContent();
	/** Set the .game file to use. */
	bool setGameFile(const string& filename);
	/** Set password for encrypted .game file. */
	void setPassword(const string& password);
	/** Set whether game resource should be load from .game file.
	 This method will affect behaviors of the following load function.
	*/
	void setUsingGameFile(bool isRead);
	bool isUsingGameFile() const;
	/** Load a texture from either a certain folder or a .game pack with only filename. */
	CCTexture2D* loadTexture(const char* filename);
	/** Get file data content and size from either a certain folder or a .game pack with only filename. */
	char* loadFile(const char* filename, unsigned long& size);
	/** Extract file from .game file to certain place.
	 Returning the new file`s full pathname.
	 Extracting files with same name but different extensions causes errors.
	*/
	string extractGameFile(const char* filename);
	/** Get the full path name of the file if it was extracted. */
	string getExtractedName(const char* filename);
	/** Singleton method. */
	static oContent& sharedContent();
protected:
	oContent();
	string _password;
	string _gameFileName;
	string _tempFolder;
	string _pathRoot;
private:
	bool _isUsingGameFile;
};

#define oSharedContent oContent::sharedContent()

#endif